This article provides a detailed example of how to set up an agent to act on selected documents in the inbox.
An agent is what you can use in Lotus Notes to automate tasks.